#include "../Headers/employ.h"
#include <iostream>
using namespace std;

int Person::number = 0;
// 有参构造函数
Person::Person(string myname, int postId)
{
    name = myname;
    id = number++;
    switch (postId)
    {
    case 1:
        post = Boss;
        break;
    case 2:
        post = Leader;
        break;
    default:
        post = Staff;
        break;
    }
}
// 无参构造
Person::Person()
{
    name = " ";
    id = 0;
}

void Person::setName(string myname)
{
    name = myname;
}
void Person::setID(int myid)
{
    id = myid;
}
void Person::setPost(Post mypost)
{
    post = mypost;
}

string Person::getName()
{
    return name;
}
int Person::getId()
{
    return id;
}
Post Person::getPost()
{
    return post;
}

// 重载赋值运算符
Person &Person::operator=(const Person &other)
{
    if (this != &other)
    {
        this->name = other.name;
        this->id = other.id;
    }
    return *this;
}

// 重载<<操作符
ostream &operator<<(ostream &os, const Person &person)
{
    os << "工号：" << person.id << "姓名：" << person.name << "职位：" << person.post;
}